package com.stars.easyms.logger.util;

import com.stars.easyms.logger.function.EasyMsLoggerExecutor;

import java.util.List;

/**
 * <p>className: EasyMsLoggerExecutorHolder</p>
 * <p>description: EasyMs日志任务执行者的holder类</p>
 *
 * @author guoguifang
 * @date 2019-11-06 19:18
 * @since 1.3.3
 */
public final class EasyMsLoggerExecutorHolder {

    private static final ThreadLocal<List<EasyMsLoggerExecutor>> LOGGER_EXECUTOR_THREAD_LOCAL = new ThreadLocal<>();

    public static void setLoggerExecutorList(List<EasyMsLoggerExecutor> easyMsLoggerExecutorList) {
        LOGGER_EXECUTOR_THREAD_LOCAL.set(easyMsLoggerExecutorList);
    }

    public static List<EasyMsLoggerExecutor> getLoggerExecutorList() {
        return LOGGER_EXECUTOR_THREAD_LOCAL.get();
    }

    public static void clear() {
        LOGGER_EXECUTOR_THREAD_LOCAL.remove();
    }

    private EasyMsLoggerExecutorHolder() {
    }
}